#ifndef RUNSHOPTABLEWIDGET_H
#define RUNSHOPTABLEWIDGET_H

#include <QTableWidget>
#include "QHeaderView"
#include "bean/runshopbean.h"

class RunshopTableWidget : public QTableWidget
{
Q_OBJECT
private:
    QWidget *parent;

    enum colType{
        numType = 0,
        groupCityType = 1,
        groupLocationType = 2,
        groupIndexType = 3,
        remoteCityType = 4,
        remoteXiaoWeiLocationType = 5,
        remoteCityIndexType = 6,
        remoteBuyGoodsType = 7,
        timeType = 8,
        deleteType = 9
    };

public:
    RunshopTableWidget();
    explicit RunshopTableWidget(QWidget *parent = nullptr);
    ~RunshopTableWidget();
    void init();

    int creatNewRow(int num = 0, QString groupCity="", QString groupXiaoWeiLocation = "", int groupIndex = 0, QString remoteCity = "", QString remoteXiaoWeiLocation = "", int remoteCityIndex = 0, QString remoteBuyGoods = "", QString time = "");

    void readRunshopBeansSetting(QList<RunShopBean> &runShopBeans);

    bool getAllTableBeans(QList<RunShopBean*> *allRunShopBeans = nullptr, bool isNeedFindPath = false);

    bool isCreateTableFinish();
    bool getBean(int row, RunShopBean *roleBean, bool isNeedFindPath = false);
    bool saveBeans2File();

    signals:
        void logEvent(QString log);

};

#endif // RUNSHOPTABLEWIDGET_H
